home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qspinbox.h.z / qspinbox.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.9 KB  |  115 lines

  1. /****************************************************************************
  2. ** $Id: qspinbox.h,v 2.22 1998/07/03 00:09:53 hanord Exp $
  3. **
  4. ** Definition of QSpinBox widget class
  5. **
  6. ** Created : 1997
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QSPINBOX_H
  25. #define QSPINBOX_H
  26.  
  27. #ifndef QT_H
  28. #include "qframe.h"
  29. #include "qrangecontrol.h"
  30. #endif // QT_H
  31.  
  32. class QPushButton;
  33. class QLineEdit;
  34. class QValidator;
  35. struct QSpinBoxData;
  36.  
  37.  
  38. class QSpinBox: public QFrame, public QRangeControl
  39. {
  40.     Q_OBJECT
  41. public:
  42.     QSpinBox( QWidget* parent = 0, const char* name = 0 );
  43.     QSpinBox( int minValue, int maxValue, int step = 1,
  44.           QWidget* parent = 0, const char* name = 0 );
  45.     ~QSpinBox();
  46.  
  47.     const char*     text() const;
  48.     virtual const char*    prefix() const;
  49.     virtual const char*    suffix() const;
  50.     virtual QString     cleanText() const;
  51.  
  52.     void        setSpecialValueText( const char* text );
  53.     const char*     specialValueText() const;
  54.  
  55.     void         setWrapping( bool on );
  56.     bool         wrapping() const;
  57.  
  58.     void        setValidator( QValidator* v );
  59.  
  60.     QSize         sizeHint() const;
  61.  
  62. public slots:
  63.     virtual void    setValue( int value );
  64.     virtual void    setPrefix( const char* text );
  65.     virtual void    setSuffix( const char* text );
  66.     virtual void    stepUp();
  67.     virtual void    stepDown();
  68.  
  69. signals:
  70.     void        valueChanged( int value );
  71.     void        valueChanged( const char* valueText );
  72.  
  73. protected:
  74.     virtual QString    mapValueToText( int value );
  75.     virtual int        mapTextToValue( bool* ok );
  76.     QString        currentValueText();
  77.  
  78.     virtual void    updateDisplay();
  79.     virtual void    interpretText();
  80.  
  81.     QPushButton*    upButton() const;
  82.     QPushButton*    downButton() const;
  83.     QLineEdit*        editor() const;
  84.  
  85.     virtual void    valueChange();
  86.     virtual void    rangeChange();
  87.  
  88.     bool        eventFilter( QObject* obj, QEvent* ev );
  89.     void        resizeEvent( QResizeEvent* ev );
  90.  
  91.     void        paletteChange( const QPalette& );
  92.     void        enabledChange( bool );
  93.     void        fontChange( const QFont& );
  94.     void        styleChange( GUIStyle );
  95.  
  96. protected slots:
  97.     void        textChanged();
  98.  
  99. private:
  100.     void initSpinBox();
  101.     struct QSpinBoxData* extra;
  102.     QPushButton* up;
  103.     QPushButton* down;
  104.     QLineEdit* vi;
  105.     QValidator* validator;
  106.     QString pfix;
  107.     QString sfix;
  108.     QString specText;
  109.     bool wrap;
  110.     bool edited;
  111. };
  112.  
  113.  
  114. #endif
  115.